﻿CREATE proc loadmodule        
as        
  

declare @bangtam table( 
	NhomCT int,
	DienGiai nvarchar(250) ,
	ThuTuSapXep int
	)
insert into @bangtam(NhomCT,DienGiai,ThuTuSapXep)
select NhomCT,cast(ROW_NUMBER() OVER(ORDER BY ThuTuSapXep) as varchar(20))+'. '+DienGiai,ThuTuSapXep from DanhMuc_NhomChuongTrinh  

select  a.MaChuongTrinh,a.TenChuongTrinh,b.DienGiai as Nhom,
Hinh as Icon  from DanhMuc_ChuongTrinh a,@bangtam b        
        
Where a.NhomCT=b.NhomCT  
order by a.TenChuongTrinh  